<?php
if ( stristr($_SERVER["HTTP_ACCEPT"],"application/xhtml+xml") ) {
  header("Content-type: application/xhtml+xml; charset=utf-8");
}
else {
  header("Content-type: text/html; charset=utf-8");
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
	<head profile="
		http://www.w3.org/2003/g/data-view
		http://dublincore.org/documents/dcq-html/
		http://gmpg.org/xfn/11"
	>
		<?php
			include '../../../includes/meta.inc';
			include '../../../includes/utilities.php';
		?>
		<title>suda.co.uk/projects/microformats [hCalendar]</title>
	</head>
	<body id="suda-co-uk">
		<div class="col300">
		<a href="http://suda.co.uk" title="suda.co.uk" accesskey="1" rel="me"><img src="/images/mast.png" id="mast" alt="suda.co.uk" /></a>
		<h1>hCalendar</h1>
<?php
if (isSet($_GET['error'])){
  echo '<h2 class="notice">ERROR IN TRANSFORMATION</h2>';
  switch($_GET['error']){
    case 0: echo '<p class="notice">No vCards could be found to transform. Please check the URL and site to make sure there are properly encoded.</p>'; break;
    case 1: echo '<p class="notice">No iCals could be found to transform. Please check the URL and site to make sure there are properly encoded.</p>'; break;
    case 2: echo '<p class="notice"></p>'; break;
    default: echo '<p class="notice">There has been an error with the transformation.</p>';
  }
}
?>
		<h2 id="introduction">Introduction</h2>
		<p>This is a <em>BETA</em> implementation of an <abbr title="eXtensible Stylesheet Language Transformation" class="initialism">XSLT</abbr> file to transform hCalendar encoded <abbr title="eXtensible Hyper Text Markup Language" class="initialism">XHTML</abbr> file into the corresponding <abbr title="Internet Calendar">iCalendar</abbr> file. The DRAFT specification for hCalendar encodings can be found at the Microformats Wiki.</p>
		<ul>
		<li><a href="http://microformats.org/wiki/hcalendar" title="Microformats Wiki entry about hCalendar" class="external">http://microformats.org/wiki/hcalendar</a></li>
		</ul>
		<p>As the specification become less of a moving target the <abbr title="eXtensible Stylesheet Language Transformation" class="initialism">XSLT</abbr> file will solidify and a proper html profile created.
		</p>
		<form action="get-cal.php" method="get">
		<fieldset>
		<legend>Extract Calendar Data from <abbr title="Universal Resource Locator" class="initialism">URL</abbr></legend>
		<input type="text" size="45" value="http://suda.co.uk/projects/holidays/" name="uri" />
		<select name="type">
			<option value="ics">iCalendar</option>
			<option value="timeline-xml">SIMILE Timeline</option>
		</select>
		<input type="submit" value="Extract Events" />
		</fieldset>
		</form>

		<h2 id="tools">Tools</h2>
		<p>These are a few tools for anyone who wants to decode hCalendar data.
		</p>
		<dl>
		<dt>iCalendar</dt>
		<dd>
		<p>If you want to create buttons or links to signal that a page is hCalendar encoded, you can link to the transformation by using the following:
<code>http://suda.co.uk/projects/microformats/hcalendar/get-cal.php?uri=&lt;COMPLETE-URL-TO-YOUR-SITE&gt;</code></p>
		<p>Drag this bookmarklet to the bookmarks bar so you can grab <abbr title="Internet Calendar">iCal</abbr> data from any <abbr title="HTML iCalendar">hCal</abbr> participating <abbr title="Universal Resource Locator" class="initialism">URL</abbr>.<br />
		<a href="javascript:location.href='http://suda.co.uk/projects/microformats/hcalendar/get-cal.php?uri='+escape(location.href)">Extract <abbr title="Internet Calendar">iCal</abbr> data</a> (Drag link to the Bookmarks Bar).
		</p>
		<p>The <abbr title="eXtensible Stylesheet Language Transformation" class="initialism">XSLT</abbr> file used to transform the data is available at:</p>
		<ul>
		<li><a href="http://suda.co.uk/projects/microformats/hcalendar/xhtml2vcal.xsl" title="XSLT file for the transformation">xhtml2vcal.xsl</a></li>
		</ul>
		</dd>
		<dt>SIMILE Timeline</dt>
		<dd>
			<p>The SIMILE project at MIT has created an <a href="http://simile.mit.edu/timeline/" class="external">Open Source Javascript timeline</a> application. The timeline takes XML, <abbr title="Javascript Object Notation">JSON</abbr> or SPARQL as input and plots the information onto the timeline. I have added the ability to convert any hCalendar encoded page into the XML needed to import into this timeline. I have setup an <a href="/projects/microformats/hcalendar/timeline/">example page</a> to demonstrate how you can pull-in any hCalendar page into the timeline. It isn't pretty, but it should convey the idea and get anyone started who wants to implement something similar.</p>
			<p>The <abbr title="eXtensible Stylesheet Language Transformation" class="initialism">XSLT</abbr> file used to transform the data is available at:</p>
			<ul>
			<li><a href="http://suda.co.uk/projects/microformats/hcalendar/xhtml2timeline.xsl" title="XSLT file for the transformation">xhtml2timeline.xsl</a></li>
			<li>@TODO, make a <abbr title="Javascript Object Notation">JSON</abbr> version of the <abbr title="eXtensible Stylesheet Language Transformation" class="initialism">XSLT</abbr></li>
			</ul>			
		</dd>
		</dl>
		<h2 id="implementations">Implementations</h2>
		<p><a href="http://technorati.com/" class="external">Technorati</a> uses this hCalendar to iCalendar as one of their services. They are using slightly older, stable versions of the <abbr title="eXtensible Stylesheet Language Transformation" class="initialism">XSLT</abbr> files, but their servers are faster and more reliable than my site. Feel free to use either of our web services.</p>
		<ul>
			<li><a href="http://technorati.com/events/" class="external">http://technorati.com/events/</a></li>
		</ul>
		<h2 id="download">Download</h2>
		<p>All of the <abbr title="PHP Hypertext Preprocessor" class="initialism">PHP</abbr> code and <abbr title="eXtensible Stylesheet Language Transformation" class="initialism">XSLT</abbr> files are available for download through our Hg versioning system, <a href="http://hg.microformats.org/" class="external">http://hg.microformats.org/</a></p>
		<h2 id="copyright">Copyleft</h2>
		<p>The <abbr title="eXtensible Stylesheet Language Transformation" class="initialism">XSLT</abbr> files have been relicensed and are available for download under the <a class="external"
href="http://www.w3.org/Consortium/Legal/copyright-software-19980720" rel="license">
W3C Open Source License</a>.</p>
		<?php
			include '../../../includes/foot.inc';
		?>
		</div>
	</body>
</html>